#ifndef _UI_PART2DWIDGET_H_
#define _UI_PART2DWIDGET_H_

#include "ui_widget.h"
#include "part2d/part2d.h"

namespace ui
{
class UIPart2DWidget : public UIWidget
{
public:
/// stuff that every self-respecting widget should have
						UIPart2DWidget(UIWidget* pParent,const std::string& Name = "");
	virtual				~UIPart2DWidget();
	virtual bool		Create(const std::string& Name, const math::Vec2& Pos = math::Vec2(0.5f, 0.5f), const math::Vec2& Size= math::Vec2(0.1f, 0.1f));
	virtual	bool		Load(LuaPlus::LuaObject& _LObj);
	void				ClearParticles();

	/// update
	virtual	bool		Tick(float dt);
	/// display
	virtual void		PostRender();
	virtual bool		Render(bool Force = false);

	/// register with LUA Bind
	static	void		Register(LuaPlus::LuaState* _pScript);

	virtual UIWidget*	GetClone();

	void				SetPartFile(const std::string& File);
	void				SavePartFile(const std::string& File);

	bool				IsPaused() { return m_Paused; };
	void				SetPaused(bool b) { m_Paused = b; };
	void				TriggerParticles(int Count);

	part2d::Part2D*		GetPartsys() { return m_pPartSys; };
protected:
	virtual bool		ExportSpecificsToFile(script::WriteLua*	pWL);

	part2d::Part2D*				m_pPartSys;
	bool						m_Paused;
	bool						m_PostRender;
};


}  //namespace ui

#endif // _UI_PART2DWIDGET_H_